VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "ObjectElement"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Public XmlObject As IXMLDOMElement
Public XmlUL As IXMLDOMElement

Private Objects As New Collection
Private Params As New Collection

Public Sub Initialize(ByVal parent As IXMLDOMElement, Optional ByVal strtype As String = "text/sitemap")
    Set XmlObject = parent.appendChild(xml.createElement("OBJECT"))
    Call XmlObject.setAttribute("type", strtype)
    Set XmlUL = parent.appendChild(xml.createElement("UL"))
End Sub

Public Function AddObject() As ObjectElement
    Dim XmlLI As IXMLDOMElement
    Set XmlLI = xml.createElement("LI")
    Call XmlUL.appendChild(XmlLI)
    
    Dim obj As ObjectElement
    Set obj = New ObjectElement
    Call obj.Initialize(XmlLI)
    
    Call Objects.Add(obj)
    Set AddObject = obj
End Function

Public Function AddParam(ByVal Name As String, ByVal Value As String) As ParamElement
    Dim Param As ParamElement
    Set Param = New ParamElement
    
    Call Param.Initialize(XmlObject)
    With Param
        .Name = Name
        .Value = Value
    End With
    
    Call Params.Add(Param)
    Set AddParam = Param
End Function

Public Function NewEnum() As IUnknown
Attribute NewEnum.VB_UserMemId = -4
    Set NewEnum = Objects.[_NewEnum]
End Function

Public Property Get HasChild() As Boolean
    HasChild = (Objects.Count > 0)
End Property

Public Property Get IsRoot() As Boolean
    IsRoot = XmlObject.getAttribute("type") = "text/site properties"
End Property

Private Sub Class_Initialize()
    Set Objects = New Collection
    Set Params = New Collection
End Sub

Private Sub Class_Terminate()
    Set Objects = Nothing
    Set Params = Nothing
End Sub
